//
//  YYENaivigationController.m
//  YuYingEDU
//
//  Created by 胡波 on 2017/12/27.
//  Copyright © 2017年 胡波. All rights reserved.
//

#import "YYENaivigationController.h"

@interface YYENaivigationController ()

@end

@implementation YYENaivigationController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    
    [self.navigationBar setBackgroundImage:[UIImage imageNamed:@"navi"] forBarMetrics:UIBarMetricsDefault];
    
}


- (void)pushViewController:(UIViewController *)viewController animated:(BOOL)animated {
    
    if (self.childViewControllers.count) {
        
        viewController.hidesBottomBarWhenPushed = YES;
        
//        viewController.navigationItem.leftBarButtonItem = [[UIBarButtonItem alloc]initWithImage:[UIImage imageNamed:@"back"] style:UIBarButtonItemStyleDone target:self action:@selector(back)];
        
        __weak typeof(viewController)WeakSelf = viewController;
        self.interactivePopGestureRecognizer.delegate = (id)WeakSelf;
        
    }
    [super pushViewController:viewController animated:animated];
    
}

//- (void)back {
//
//    if ((self.presentedViewController || self.presentingViewController)&& self.childViewControllers.count == 1) {
//        [self dismissViewControllerAnimated:YES completion:nil];
//    }else {
//        [self popViewControllerAnimated:YES];
//    }
//
//}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
